package com.cloudpan.service.impl;


import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.cloudpan.entity.param.MessageParam;
import com.cloudpan.entity.pojo.SysUserMessage;
import com.cloudpan.entity.vo.SysUserMsgVo;
import com.cloudpan.mapper.SysUserMessageMapper;
import com.cloudpan.service.SysUserMessageService;
import lombok.RequiredArgsConstructor;
import org.springframework.beans.BeanUtils;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author Code Generator
 * @since 2024-01-27
 */
@Service
@RequiredArgsConstructor
public class SysUserMessageServiceImpl extends ServiceImpl<SysUserMessageMapper, SysUserMessage> implements SysUserMessageService {

    private final SysUserMessageMapper sysUserMessageMapper;

    @Override
    public Boolean saveMessage(MessageParam param) {
        SysUserMessage sysUserMessage = new SysUserMessage();
        BeanUtils.copyProperties(param,sysUserMessage);
        return sysUserMessageMapper.insert(sysUserMessage) > 0;
    }

    @Override
    public List<SysUserMsgVo> disMessage(String uid, String fid) {
        List<SysUserMsgVo> result =  sysUserMessageMapper.selectByUidAndFid(uid,fid);
        return result;
    }
}
